package com.besmart.workflow.core.model;

import java.util.ArrayList;
import java.util.List;

public class OperationNode {

	private OperationDescriptor descriptor;
	private String input;
	private String template;
	private List<ConditionNode> conditions;
	
	public OperationNode(OperationDescriptor descriptor) {
		this.descriptor = descriptor;
		this.conditions = new ArrayList<ConditionNode>();
	}
	
	public ConditionNode getConditionByTrigger(String trigger)
	{
		for(ConditionNode condition : conditions)
		{
			if(condition.getTriggerSig().equals(trigger))
			{
				return condition;
			}
		}
		return null;
	}
	
	public void addCondition(ConditionNode condition)
	{
		this.conditions.add(condition);
	}

	public OperationDescriptor getDescriptor() {
		return descriptor;
	}

	public void setInput(String input)
	{
		this.input = input;
	}

	public String getInput() {
		return input;
	}
	
	public void setTemplate(String template)
	{
		this.template = template;
	}

	public String getTemplate() {
		return template;
	}

	public List<ConditionNode> getConditions() {
		return conditions;
	}
	
	
}
